home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / cmouse.zip / CMOUSE.DOC < prev    next >
Text File  |  1991-04-02  |  6KB  |  166 lines

  1.     Cmouse.cpp for Borland C++
  2.     ==========================
  3.  
  4.  
  5.     Thank you for downloading cmouse.zip.  Compile and run
  6.     cmouse.cpp which includes demo code.  A mouse interrupt
  7.     handler is provided and should serve most all your
  8.     needs.  To use cmouse.cpp in your own application,
  9.     comment out "#define TEST_CMOUSE_CPP" near the end of
  10.     the cmouse.cpp file.
  11.  
  12.     The MicrosoftMouse class provides member functions for
  13.     all Microsoft Mouse Driver functions packaged in a
  14.     convenient interface.  Do not instantiate any instances
  15.     of the class - instead access them through MM, the only
  16.     instance of MicrosoftMouse!
  17.  
  18.     For example:
  19.  
  20.     #include <stdio.h>
  21.     #include <cmouse.hpp>
  22.  
  23.     main()
  24.     {
  25.         MM.show();
  26.         MM.autoEventUpdate();
  27.         while (!MM.leftPressed) do;
  28.         puts("Mouse's left button pressed.");
  29.         return 0;
  30.     }
  31.  
  32.     All omouse coordinates are expressed in Borland C++'s
  33.     physical screen coordinates rather than the mouse's
  34.     virtual coordinates.  Be sure to call MM.reset() after
  35.     each video mode change to enable this feature!
  36.  
  37.     Since MM is a global instance of the MicrosoftMouse
  38.     class, its constructor and destructor take care of
  39.     preparing the mouse for use in your program.
  40.  
  41.     Look at the MicrosoftMouse class declaration in
  42.     cmouse.hpp.  You will soon notice that the member
  43.     functions don't typically pass parameters but values
  44.     are instead stored directly in the MM instance's data
  45.     fields.  The reason I don't pass parameters is so you
  46.     don't have to provide variables to store them in.
  47.     Secondly, cmouse has a special function called
  48.     autoEventUpdate() that activates a prewritten mouse
  49.     event interrupt handler.  All you do is call
  50.     MM.autoEventUpdate() and it updates the MM's data
  51.     fields whenever a mouse event happens as specified
  52.     by MM.eventMask.  The mask is preconfigured to request
  53.     an update whenever the mouse moves, or a mouse button
  54.     is pressed or released.  That way your application
  55.     simply poles these fields for updates.  This should
  56.     satisfy most of your requirements.  If you need
  57.     something more sophisticated, you can use the code
  58.     of autoEventHandler() to cookbook your interrupt
  59.     handler!
  60.  
  61.     For example:
  62.  
  63.  
  64.     MM.x = 10; MM.y = 20; MM.gotoxy();
  65.  
  66.     // moves the mouse cursor to (10,20).
  67.  
  68.  
  69.     MM.updateStatusInfo()
  70.     if (MM.leftPressed)
  71.         // if left button pressed.
  72.  
  73.  
  74.     If you are wondering what the total effect of calling
  75.     MM.updateStatusInfo() is you can study the source.  If
  76.     you want to do any serious mouse programming it would
  77.     be a good idea to pick up
  78.  
  79.     "Microsoft Mouse Programmer's Reference."
  80.         Bellevue, Washington: Microsoft Press, 1989.
  81.  
  82.     This is the main reference I used in coding cmouse.
  83.     Rather than repeat what is in this book or explain what
  84.     the mouse functions do, you should reference this book.
  85.     By using the book and reading the header of cmouse,
  86.     you will soon get the picture of what's going on.
  87.  
  88.  
  89.     Of course if you had activated the provided mouse
  90.     interrupt handler, all you would have to do to see if
  91.     the left button was pressed is test the field:
  92.  
  93.  
  94.     if (MM.leftPressed)
  95.         // if left button pressed.
  96.  
  97.  
  98.     To enable the mouse interrupt handler, you must
  99.     call MM.autoEventUpdate().  Check the demo code to see
  100.     if you can find this.  Also study the display of the
  101.     demo.  It displays many of the fields of MM.  Use
  102.     the mouse and see how these fields register the changes.
  103.     The function MouseReport() in the demo produces this
  104.     report.  Look there to see how the fields are accessed.
  105.  
  106.  
  107.     I have tested the omouse unit with Microsoft Mouse
  108.     driver version 7.00 and Microsoft's second generation
  109.     serial mouse as well as the ATI VGA Wonder Plus bus
  110.     mouse.  If the demo won't run in graphics mode the
  111.     most likey cause is your mouse driver doesn't support
  112.     the more advanced features of your graphics card.  I
  113.     know, you have a paint program that works fine with
  114.     your mouse and driver so it must be cmouse.  Well many
  115.     paint programs provide their own builtin drivers to
  116.     keep you from calling them with the same problem.
  117.     Believe me, call your mouse manufacturer and get the
  118.     latest driver.  If you must call me, don't call in the
  119.     middle of the night, please!
  120.  
  121.  
  122.     Super VGA Modes
  123.     ===============
  124.  
  125.     At this time I am awaiting information from VESA for
  126.     VESA compliant SVGA modes.  When I do I'll update
  127.     cmouse for those modes.  In the mean time if you want
  128.     to try it yourself you must modify Xcell[], Ycell[],
  129.     LeftTopOfs[], virtualX(), virtualY(), physicalX(),
  130.     and physicalY().  The standard modes documented in
  131.     the Microsoft Mouse Programmer's Reference are for
  132.     video modes 0-13 hex.  This made it easy to implement
  133.     Xcell, Ycell, and LeftTopOfs in arrays.  I'm thinking
  134.     that I will simply remap modes 23, 27, 33, 37, 54, 6A,
  135.     61, 62, 63, 65, and 67 hex into MM.vmode just above
  136.     13 hex so that these arrays can simply be extended.
  137.     I use these arrays to automatically convert between
  138.     physical screen coordinates and mouse virtual
  139.     coordinates.
  140.  
  141.  
  142.  
  143.     Registration
  144.     ============
  145.  
  146.     If you find cmouse useful and are using it in your
  147.     applications, tell your friends.  You don't need to
  148.     register cmouse -- it's freeware!  All I ask is that
  149.     you leave my copyright notice intact!
  150.  
  151.  
  152.  
  153.  
  154.     Thanks again!
  155.  
  156.  
  157.     John W. Small
  158.     CIS: 73757,2233
  159.  
  160.     PSW / Power SoftWare
  161.     P.O. Box 10072
  162.     McLean, VA 22102 8072
  163.     (703) 759-3838
  164.  
  165.  
  166.